// import Vue from 'vue'
// import VueRouter,
import {createRouter,createWebHashHistory } from 'vue-router'
import Layout from '@/views/layout/LayoutIndex.vue'
import Login from '@/views/login/LoginIndex.vue'
import Home from '@/views/home/HomeFirst.vue'

const Product=()=>import('@/views/product/ProductIndex.vue')
const ProductList=()=>import('@/views/product/list/ListIndex.vue')
const ProductCategory=()=>import('@/views/product/category/CategoryIndex.vue')

const Order=()=>import('@/views/order/OrderIndex.vue')
const OrderList=()=>import('@/views/order/list/ListIndex.vue')
const OrderCollect=()=>import('@/views/order/collect/CollectIndex.vue')

const Advert=()=>import('@/views/advert/AdvertIndex.vue')
const AdvertList=()=>import('@/views/advert/list/ListIndex.vue')

const router = createRouter({

    history: createWebHashHistory(),//路由模式
    routes: [
        {
            path: '/',
            component: Layout,
            children:[
                {
                    path:'/',
                    name:'home',
                    component:Home
                },
                {
                    path:'/product',//产品的
                    name:'product',
                    component:Product,
                    children:[
                        {
                            path:'/list',
                            name:'productlist',
                            component:ProductList
                        },
                        {
                            path:'/category',
                            name:'productcategory',
                            component:ProductCategory
                        },
                    ]
                },
                {
                    path:'/order',//订单的
                    name:'order',
                    component:Order,
                    children:[
                        {
                            path:'/list',
                            name:'orderlist',
                            component:OrderList
                        },
                        {
                            path:'/collect',
                            name:'ordercollect',
                            component:OrderCollect
                        },
                    ]
                },
                {
                    path:'/advert',//广告的
                    name:'advert',
                    component:Advert,
                    children:[
                        {
                            path:'/list',
                            name:'advertlist',
                            component:AdvertList
                        },
                    ]
                },
            ]
        },
        {
            // 拖拽
            path: '/login', // 这是访问路径
            name: 'login',
            component: Login // 路由的源文件
        }
    ]
})

export default router